Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added higher-level API for querying a node's degree in a graph #75

Merged
merged 2 commits into from
Dec 13, 2023

Conversation

denk0403
Copy link
Contributor

@denk0403 denk0403 commented Apr 8, 2023

As pointed out in #74, the current method for getting a node's degree in a graph (Degree(n *Node, in, out int)) is unergonomic for most use cases and unnecessarily mimics its C counterpart.

This PR introduces higher-level API methods (Indegree(n *Node), Outdegree(n *Node), and TotalDegree(n *Node))** that simplify retrieving a node's indegree, outdegree, or sum of both. It also adds documentation to the relevant methods to communicate better how they should be used.

** I'm open to changing these names if they're unclear or don't follow the naming convention.

Copy link
Owner

@goccy goccy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍
Thank you for your contribution !

@goccy goccy merged commit 9f8e121 into goccy:master Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants